package com.cjy.runnable.demo7;

/**
 * @author Cheng JiYe
 * @description:
 * @date 2021/4/25 1:06
 */
public class ThreadPriorityDemo {
  public static void main(String args[]) {
    // 实例化线程对象
    Thread t1 = new Thread(new MyThread(), "线程A");
    // 实例化线程对象
    Thread t2 = new Thread(new MyThread(), "线程B");
    // 实例化线程对象
    Thread t3 = new Thread(new MyThread(), "线程C");

    // 优先级最低
    t1.setPriority(Thread.MIN_PRIORITY);
    // 优先级最高
    t2.setPriority(Thread.MAX_PRIORITY);
    // 优先级最中等
    t3.setPriority(Thread.NORM_PRIORITY);
    t1.start(); // 启动线程
    t2.start(); // 启动线程
    t3.start(); // 启动线程
  }
}
